package com.datasure.demo.service;

import com.datasure.demo.bo.UserInfo;
import org.springframework.stereotype.Component;

/**
 * @author xiaolong5.zhang
 * @date 2022/04/07 16:55
 **/
@Component
public class UserInfoService {

    public UserInfo findByUsername(String username){
        if("xiaoming".equals(username)){
            return UserInfo.builder()
                    .username(username)
                    .password("123456")
                    .role(UserInfo.Role.first).build();
        }else if("xiaohong".equals(username)){
            return UserInfo.builder()
                    .username(username)
                    .password("123456")
                    .role(UserInfo.Role.second).build();
        }else {
            return null;
        }
    }
}
